package com.noble.meether.chat.ui.agora.act.bean;

import com.noble.library.base.bean.BaseData;

import org.json.JSONArray;

import java.util.ArrayList;

/**
 * 标签列表
 */
public class LabelList extends BaseData {
    private ArrayList<Label> labelList = new ArrayList<>();

    private ArrayList<String> praiseLabel = new ArrayList<>();      // 赞美标签
    private ArrayList<String> criticizeLabel = new ArrayList<>();   // 批评标签

    @Override
    public void parseJson(String jsonStr) {
        JSONArray jsonArray = getJsonArray(jsonStr);
        this.labelList = (ArrayList<Label>) getBaseDataList(jsonArray, Label.class);
        initList();
    }

    public ArrayList<Label> getLabelList() {
        return labelList;
    }

    private void initList() {
        if (labelList == null || labelList.size() <= 0) return;
        praiseLabel.clear();
        criticizeLabel.clear();

        for (Label label : labelList) {
            if (label.getStarMax() >= 4) {
                praiseLabel.add(label.getLabel());
            } else {
                criticizeLabel.add(label.getLabel());
            }
        }
    }

    public ArrayList<String> getPraiseLabel() {
        return praiseLabel;
    }

    public ArrayList<String> getCriticizeLabel() {
        return criticizeLabel;
    }
}
